home *** CD-ROM | disk | FTP | other *** search
/ Adobe Digital Video Collection / Digital Video Collection CD.iso / After Effects 5.5 / MMScriptEng.Cab / F115582_parallax.mm < prev    next >
Encoding:
Text File  |  2001-12-07  |  1.4 KB  |  29 lines

  1. // Copy Relative Values - Version 1.1
  2.  
  3. // This Script copies the relative values from the 2nd set of popups into the 1st set of popups.
  4. // By adjusting the scale factor, you can simulate motion parallax.
  5. // change the scale factor to numbers smaller than 1 for layer 1 behind layer 2.
  6. // Change the scale factor to numbers greater than 1 for layer 1 in front of layer 2.
  7.  
  8. //      LAYER                                               PROPERTY                     CHANNEL
  9. //      ------                                              ----------                     --------
  10. // 1: Layer being affected                          property affected           channel affected
  11. // 2: Layer to copy relative values from    property copying from    channel copying from
  12.  
  13. if (time() == start_time) { // Initialization
  14.  
  15.     scale_factor = 1.0;        // > 1 means scale up, < 1 means scale down
  16.  
  17.     // Compute the initial values for layer 1 and 2
  18.     start_val1 = value(pop_layer(1), pop_property(1))[pop_channel(1)];
  19.     start_val2 = value(pop_layer(2), pop_property(2))[pop_channel(2)];
  20.  
  21. } else {                                                            // For every frame after the first
  22.   
  23.     // Calculate the current value for layer 2
  24.     current_val2 = value(pop_layer(2), pop_property(2)) [pop_channel(2)];
  25.  
  26.     // Assign scaled values from layer 2 to layer 1.
  27.     value(pop_layer(1), pop_property(1)) [pop_channel(1)] =
  28.         start_val1 + (current_val2 - start_val2) * scale_factor;
  29. }